using System;
using NUnit.Framework;
using dnA.Math;

namespace dnA.dnAtests.Math 
{
	[TestFixture]
	public class ComplexMath_CosTest
	{
		[Test]
		public void Cos()
		{
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(0.0,1.19209289550780998537e-7)), new ComplexDouble(1.00000000000000710543,0.0), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(0.0,-1.19209289550780998537e-7)), new ComplexDouble(1.00000000000000710543,0.0), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(0.0,5.0e-1)), new ComplexDouble(1.12762596520638078523,0.0), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(0.0,-5.0e-1)), new ComplexDouble(1.12762596520638078523,0.0), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(0.0,1.0)), new ComplexDouble(1.54308063481524377848,0.0), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(0.0,-1.0)), new ComplexDouble(1.54308063481524377848,0.0), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(0.0,2.0)), new ComplexDouble(3.76219569108363145956,0.0), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(0.0,-2.0)), new ComplexDouble(3.76219569108363145956,0.0), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(1.19209289550780998537e-7,0.0)), new ComplexDouble(9.99999999999992894573e-1,0.0), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(-1.19209289550780998537e-7,0.0)), new ComplexDouble(9.99999999999992894573e-1,0.0), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(1.19209289550780998537e-7,1.19209289550780998537e-7)), new ComplexDouble(1.0,-1.4210854715201943764e-14), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(1.19209289550780998537e-7,-1.19209289550780998537e-7)), new ComplexDouble(1.0,1.4210854715201943764e-14), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(-1.19209289550780998537e-7,1.19209289550780998537e-7)), new ComplexDouble(1.0,1.4210854715201943764e-14), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(-1.19209289550780998537e-7,-1.19209289550780998537e-7)), new ComplexDouble(1.0,-1.4210854715201943764e-14), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(1.19209289550780998537e-7,5.0e-1)), new ComplexDouble(1.12762596520637277296,-6.21194011561566624892e-8), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(1.19209289550780998537e-7,-5.0e-1)), new ComplexDouble(1.12762596520637277296,6.21194011561566624892e-8), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(-1.19209289550780998537e-7,5.0e-1)), new ComplexDouble(1.12762596520637277296,6.21194011561566624892e-8), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(-1.19209289550780998537e-7,-5.0e-1)), new ComplexDouble(1.12762596520637277296,-6.21194011561566624892e-8), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(1.19209289550780998537e-7,1.0)), new ComplexDouble(1.54308063481523281423,-1.40094899373507046038e-7), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(1.19209289550780998537e-7,-1.0)), new ComplexDouble(1.54308063481523281423,1.40094899373507046038e-7), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(-1.19209289550780998537e-7,1.0)), new ComplexDouble(1.54308063481523281423,1.40094899373507046038e-7), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(-1.19209289550780998537e-7,-1.0)), new ComplexDouble(1.54308063481523281423,-1.40094899373507046038e-7), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(1.19209289550780998537e-7,2.0)), new ComplexDouble(3.76219569108360472755,-4.32355452519297901029e-7), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(1.19209289550780998537e-7,-2.0)), new ComplexDouble(3.76219569108360472755,4.32355452519297901029e-7), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(-1.19209289550780998537e-7,2.0)), new ComplexDouble(3.76219569108360472755,4.32355452519297901029e-7), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(-1.19209289550780998537e-7,-2.0)), new ComplexDouble(3.76219569108360472755,-4.32355452519297901029e-7), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(5.0e-1,0.0)), new ComplexDouble(8.77582561890372716116e-1,0.0), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(-5.0e-1,0.0)), new ComplexDouble(8.77582561890372716116e-1,0.0), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(5.0e-1,1.19209289550780998537e-7)), new ComplexDouble(8.77582561890378951715e-1,-5.71519778495077043139e-8), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(5.0e-1,-1.19209289550780998537e-7)), new ComplexDouble(8.77582561890378951715e-1,5.71519778495077043139e-8), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(-5.0e-1,1.19209289550780998537e-7)), new ComplexDouble(8.77582561890378951715e-1,5.71519778495077043139e-8), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(-5.0e-1,-1.19209289550780998537e-7)), new ComplexDouble(8.77582561890378951715e-1,-5.71519778495077043139e-8), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(5.0e-1,5.0e-1)), new ComplexDouble(9.89584883399919936444e-1,-2.4982639750046153149e-1), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(5.0e-1,-5.0e-1)), new ComplexDouble(9.89584883399919936444e-1,2.4982639750046153149e-1), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(-5.0e-1,5.0e-1)), new ComplexDouble(9.89584883399919936444e-1,2.4982639750046153149e-1), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(-5.0e-1,-5.0e-1)), new ComplexDouble(9.89584883399919936444e-1,-2.4982639750046153149e-1), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(5.0e-1,1.0)), new ComplexDouble(1.35418065670458429296,-5.63421465230981780955e-1), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(5.0e-1,-1.0)), new ComplexDouble(1.35418065670458429296,5.63421465230981780955e-1), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(-5.0e-1,1.0)), new ComplexDouble(1.35418065670458429296,5.63421465230981780955e-1), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(-5.0e-1,-1.0)), new ComplexDouble(1.35418065670458429296,-5.63421465230981780955e-1), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(5.0e-1,2.0)), new ComplexDouble(3.30163733291409455749,-1.73880950447431633438), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(5.0e-1,-2.0)), new ComplexDouble(3.30163733291409455749,1.73880950447431633438), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(-5.0e-1,2.0)), new ComplexDouble(3.30163733291409455749,1.73880950447431633438), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(-5.0e-1,-2.0)), new ComplexDouble(3.30163733291409455749,-1.73880950447431633438), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(1.0,0.0)), new ComplexDouble(5.40302305868139717401e-1,0.0), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(-1.0,0.0)), new ComplexDouble(5.40302305868139717401e-1,0.0), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(1.0,1.19209289550780998537e-7)), new ComplexDouble(5.4030230586814355648e-1,-1.00311158276545610981e-7), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(1.0,-1.19209289550780998537e-7)), new ComplexDouble(5.4030230586814355648e-1,1.00311158276545610981e-7), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(-1.0,1.19209289550780998537e-7)), new ComplexDouble(5.4030230586814355648e-1,1.00311158276545610981e-7), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(-1.0,-1.19209289550780998537e-7)), new ComplexDouble(5.4030230586814355648e-1,-1.00311158276545610981e-7), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(1.0,5.0e-1)), new ComplexDouble(6.09258909157794225734e-1,-4.38486579892595275173e-1), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(1.0,-5.0e-1)), new ComplexDouble(6.09258909157794225734e-1,4.38486579892595275173e-1), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(-1.0,5.0e-1)), new ComplexDouble(6.09258909157794225734e-1,4.38486579892595275173e-1), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(-1.0,-5.0e-1)), new ComplexDouble(6.09258909157794225734e-1,-4.38486579892595275173e-1), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(1.0,1.0)), new ComplexDouble(8.33730025131149048884e-1,-9.88897705762865096382e-1), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(1.0,-1.0)), new ComplexDouble(8.33730025131149048884e-1,9.88897705762865096382e-1), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(-1.0,1.0)), new ComplexDouble(8.33730025131149048884e-1,9.88897705762865096382e-1), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(-1.0,-1.0)), new ComplexDouble(8.33730025131149048884e-1,-9.88897705762865096382e-1), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(1.0,2.0)), new ComplexDouble(2.03272300701966552944,-3.05189779915180005751), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(1.0,-2.0)), new ComplexDouble(2.03272300701966552944,3.05189779915180005751), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(-1.0,2.0)), new ComplexDouble(2.03272300701966552944,3.05189779915180005751), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(-1.0,-2.0)), new ComplexDouble(2.03272300701966552944,-3.05189779915180005751), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(2.0,0.0)), new ComplexDouble(-4.16146836547142386998e-1,0.0), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(-2.0,0.0)), new ComplexDouble(-4.16146836547142386998e-1,0.0), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(2.0,1.19209289550780998537e-7)), new ComplexDouble(-4.16146836547145343899e-1,-1.08396700242243043298e-7), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(2.0,-1.19209289550780998537e-7)), new ComplexDouble(-4.16146836547145343899e-1,1.08396700242243043298e-7), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(-2.0,1.19209289550780998537e-7)), new ComplexDouble(-4.16146836547145343899e-1,1.08396700242243043298e-7), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(-2.0,-1.19209289550780998537e-7)), new ComplexDouble(-4.16146836547145343899e-1,-1.08396700242243043298e-7), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(2.0,5.0e-1)), new ComplexDouble(-4.69257978229053413027e-1,-4.73830620416406990321e-1), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(2.0,-5.0e-1)), new ComplexDouble(-4.69257978229053413027e-1,4.73830620416406990321e-1), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(-2.0,5.0e-1)), new ComplexDouble(-4.69257978229053413027e-1,4.73830620416406990321e-1), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(-2.0,-5.0e-1)), new ComplexDouble(-4.69257978229053413027e-1,-4.73830620416406990321e-1), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(2.0,1.0)), new ComplexDouble(-6.42148124715519964845e-1,-1.0686074213827783396), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(2.0,-1.0)), new ComplexDouble(-6.42148124715519964845e-1,1.0686074213827783396), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(-2.0,1.0)), new ComplexDouble(-6.42148124715519964845e-1,1.0686074213827783396), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(-2.0,-1.0)), new ComplexDouble(-6.42148124715519964845e-1,-1.0686074213827783396), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(2.0,2.0)), new ComplexDouble(-1.56562583531574337406,-3.29789483631123661773), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(2.0,-2.0)), new ComplexDouble(-1.56562583531574337406,3.29789483631123661773), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(-2.0,2.0)), new ComplexDouble(-1.56562583531574337406,3.29789483631123661773), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(-2.0,-2.0)), new ComplexDouble(-1.56562583531574337406,-3.29789483631123661773), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(8.388608e6,0.0)), new ComplexDouble(-9.01754673758759322321e-1,0.0), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(-8.388608e6,0.0)), new ComplexDouble(-9.01754673758759322321e-1,0.0), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(8.388608e6,1.19209289550780998537e-7)), new ComplexDouble(-9.01754673758765729674e-1,-5.15280011006352744858e-8), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(8.388608e6,-1.19209289550780998537e-7)), new ComplexDouble(-9.01754673758765729674e-1,5.15280011006352744858e-8), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(-8.388608e6,1.19209289550780998537e-7)), new ComplexDouble(-9.01754673758765729674e-1,5.15280011006352744858e-8), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(-8.388608e6,-1.19209289550780998537e-7)), new ComplexDouble(-9.01754673758765729674e-1,-5.15280011006352744858e-8), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(8.388608e6,5.0e-1)), new ComplexDouble(-1.01684198437658599569,-2.2524250900412912476e-1), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(8.388608e6,-5.0e-1)), new ComplexDouble(-1.01684198437658599569,2.2524250900412912476e-1), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(-8.388608e6,5.0e-1)), new ComplexDouble(-1.01684198437658599569,2.2524250900412912476e-1), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(-8.388608e6,-5.0e-1)), new ComplexDouble(-1.01684198437658599569,-2.2524250900412912476e-1), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(8.388608e6,1.0)), new ComplexDouble(-1.39148017443127938564,-5.07978603242576038333e-1), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(8.388608e6,-1.0)), new ComplexDouble(-1.39148017443127938564,5.07978603242576038333e-1), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(-8.388608e6,1.0)), new ComplexDouble(-1.39148017443127938564,5.07978603242576038333e-1), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(-8.388608e6,-1.0)), new ComplexDouble(-1.39148017443127938564,-5.07978603242576038333e-1), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(8.388608e6,2.0)), new ComplexDouble(-3.39257754802973015548,-1.56770389112823016984), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(8.388608e6,-2.0)), new ComplexDouble(-3.39257754802973015548,1.56770389112823016984), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(-8.388608e6,2.0)), new ComplexDouble(-3.39257754802973015548,1.56770389112823016984), 5e-014);
			TestHelper.TestRelativeError(ComplexMath.Cos(new ComplexDouble(-8.388608e6,-2.0)), new ComplexDouble(-3.39257754802973015548,-1.56770389112823016984), 5e-014);
		}
	}
}
